<%@page import="com.sq.partner.manager.util.StrUtil"%>
<%@page import="java.sql.Struct"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<base href="<%=basePath%>">
<title>投保方案新增</title>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
<script src="js/jquery.validate.js" type="text/javascript" ></script>
<script src="js/jquery.divbox.js" type="text/javascript"></script>
<script src="js/json2.js" type="text/javascript"></script>

<style type="text/css">
	.input_text{width:180px;}
	.select_1{width:180px;}
	#agentInfoRela4Table{
		 margin: auto;
	}
	#agentInfoRela4Table td{
		border: 1px solid #bbcddb;
		text-align: center;  
		vertical-align:middle;
		height:15px; 
		line-height:15px;
	}
	#agentInfoRela4Table th{
		text-align: center;  
		vertical-align:middle;
	}
	#agentInfoRela6Table td{
	   text-align: center;
	}
	#agentInfoRela5Table td{
		text-align: center;
	}
	
	.table {
		 width:100%; 
		 margin:10px auto; 
		 border-left:1px #bbcddb solid; 
		 border-top:1px #bbcddb solid; 
		 background-color:#f6f7f9;
		
	}
	.table th{ 
		text-align:center; 
		line-height:30px; 
		border-bottom:1px #bbcddb solid; 
		border-right:1px #bbcddb solid;
		font-weight:normal; 
	}
	.table td{ 
		text-align:center; 
		line-height:26px; 
		font-size:10px;
		border-bottom:1px #bbcddb solid; 
		border-right:1px #bbcddb solid;   
	}
	/*--------table_c---------*/
	.table_c{ width:100%; margin:10px auto; border-left:1px #bbcddb solid; border-top:1px #bbcddb solid; background-color:#f6f7f9;}
	.table_c th{ color:#343233; width:15%; text-align:right; line-height:26px; border-bottom:1px #bbcddb solid; border-right:1px #bbcddb solid;font-weight:normal; padding-right:10px;}
	.table_c td{ color:#343233; text-align:left; line-height:26px; border-bottom:1px #bbcddb solid; border-right:1px #bbcddb solid;   padding:5px 0 5px 10px;}
</style>
</head>
<script type="text/javascript">
	//自定义map功能
	function Map(){
	  this.elements = new Array();
	   //获取MAP元素个数
	   this.size = function() {
	       return this.elements.length;
	   };
	   //判断MAP是否为空
	   this.isEmpty = function() {
	       return (this.elements.length < 1);
	   };
	   //删除MAP所有元素
	   this.clear = function() {
	       this.elements = new Array();
	   };
	   //向MAP中增加元素（key, value)
	   this.put = function(_key, _value) {
	       if(this.containsKey(_key)){
	        this.remove(_key);
	        this.elements.push( {
	           key : _key,
	           value : _value
	        });
	       }else{
	        this.elements.push( {
	           key : _key,
	           value : _value
	        });
	       }  
	   };
	   //删除指定KEY的元素，成功返回True，失败返回False
	   this.remove = function(_key) {
	       var bln = false;
	       try {
	           for (var i = 0; i < this.elements.length; i++) {
	               if (this.elements[i].key == _key) {
	                   this.elements.splice(i, 1);
	                   return true;
	               }
	           }
	       } catch (e) {
	           bln = false;
	       }
	       return bln;
	   };
	   //获取指定KEY的元素值VALUE，失败返回NULL
	   this.get = function(_key) {
	       try {
	           for (var i = 0; i < this.elements.length; i++) {
	               if (this.elements[i].key == _key) {
	                   return this.elements[i].value;
	               }
	           }
	       } catch (e) {
	           return false;
	       }
	       return false;
	   };
	   //判断MAP中是否含有指定KEY的元素
	   this.containsKey = function(_key) {
	       var bln = false;
	       try {
	           for (var i = 0; i < this.elements.length; i++) {
	               if (this.elements[i].key == _key) {
	                   bln = true;
	               }
	           }
	       } catch (e) {
	           bln = false;
	       }
	       return bln;
	   };
	  //获取map的所有values
	  this.values = function() {
	       var arr = new Array();
	       for (var i = 0; i < this.elements.length; i++) {
	           arr.push(this.elements[i].value);
	       }
	       return arr;
	   };
	  //获取map的所有keys
	  this.keys= function() {
	       var arr = new Array();
	       for (var i = 0; i < this.elements.length; i++) {
	           arr.push(this.elements[i].key);
	       }
	       return arr;
	   };
	   //获取数组
	   this.getArray= function(){
	   	var arr = new Array();
	   	for (var i = 0; i < this.elements.length; i++) {
	           arr.push({
		            key : this.elements[i].key,
		            value : this.elements[i].value
		         });
	       }
	       return arr;
	   };
	}
//********************************************	
	
	var map = new Map();
	var map1 = new Map();
	var mapBak = new Map();
	var zonMap=new Map();
	var emailMap=new Map();
	var agentInfoList = new Array();
	var salemap=new Map();
	var rolemap=new Map();
	var oldAgentType = '';//复制新增时的原agentType
	var oldPartnerNo='';//复制新增时的原partnerNo;
	var iscopy=false;
	$(function(){
		<c:choose>
			<c:when test="${not empty plan_code || not empty oldplan_code}">
				//编辑/复制新增 时，才需进行的初始化操作
				init();
			</c:when>
			<c:otherwise>
				$("#contractSolution").val("0");
				contractSolution1();
				$("#saveCreditPlanBtn").click(function(){  
					checkAndExcute('add');
				});
			</c:otherwise>
		</c:choose>
		/* e();  */  //电子保单模板
	});
	function init(){
		var flag=false;
		<c:choose>
			<c:when test="${not empty plan_code}">
				$("#saveCreditPlanBtn").click(function(){  
					checkAndExcute('update');
				});
			</c:when>
			<c:when test="${not empty oldplan_code}">
				flag=true;
				iscopy=true;
				$("#saveCreditPlanBtn").click(function(){  
					checkAndExcute('copyAdd');
				});
				$('#plan_code').css('color','#ccc');//复制新增，隐藏方案号的显示
			</c:when>
		</c:choose>
		var plan_code = $.trim($('#hideplan_code').val());
		$.ajax({
			url : "<%=path%>/CreditPlan/loadCreditPlan?"+new Date().getTime(),
			type : 'POST',
			async : false,
			data:{plan_code:plan_code},
			dataType:'json',
			success:function(data){
				if($.validate(data))return;
				var creditPlan = data.creditPlan;
				var creditProd = data.creditProd;
				oldAgentType = creditPlan.agent_type;
				oldPartnerNo = creditPlan.partner_code;
				$('#plan_code').val(creditPlan.plan_code);
				$("#agent_type").val(creditPlan.agent_type);
				$('#plan_name').val(creditPlan.plan_name);
				$('#prod_code').val(creditPlan.prod_code);
				$('#prod_name').val(creditProd.prodName);
				$('#partner_code').val(creditPlan.partner_code);
				$('#status').val(creditPlan.status);
				$("input[type=radio][name=underWritingRule][value="+creditPlan.underWriting_rule+"]").attr("checked",true);
				underWritingRuleChange();
				$("input[type=radio][name=review_the_rules][value="+creditPlan.review_the_rules+"]").attr("checked",true);
				$("#is_see_money").find("option[value="+creditPlan.is_see_money+"]").attr("selected",true);
				$('#setProjectCode').val(creditPlan.setProjectCode);
				$('#setProjectName').val(creditPlan.setProjectName);
				$('#franchiserate').val(creditPlan.franchiserate);
				$('#compenSationRatio').val(creditPlan.compenSationRatio);
				$('#waitingPeriod').val(creditPlan.waitingPeriod);
				$('#premium').val(creditPlan.premium);
				$('#new_bsns_type').val(creditPlan.new_bsns_type);
				$('#isThirdPlan').val(data.thirdPlan);
				$('#channleCode_QD').val(creditPlan.channel_code);
				$('#channel_type').val(creditPlan.channel_type);
				$('#commRate').val(creditPlan.commRate);
				$('#chargerCode').val(creditPlan.chargerCode);
				$('#comCode').val(creditPlan.comCode);
				$('#jurisdictionRight').val(creditPlan.jurisdictionRight);
				$("#is_same_person").find("option[value="+creditPlan.is_same_person+"]").attr("selected",true);changePerson();
				$("#projectType").find("option[value="+creditPlan.projectType+"]").attr("selected",true);
				$("#isInternetps").find("option[value="+creditPlan.isInternetps+"]").attr("selected",true);
				$("#businessTypes").find("option[value="+creditPlan.businessTypes+"]").attr("selected",true);
				$("#farmFlag").find("option[value="+creditPlan.farmFlag+"]").attr("selected",true);
				$("#businessClass").find("option[value="+creditPlan.businessClass+"]").attr("selected",true);
				$("#is_epolicy").find("option[value="+creditPlan.is_epolicy+"]").attr("selected",true);
				$("#contractSolution").find("option[value="+creditPlan.contractSolution+"]").attr("selected",true);
				$("#committee").val(creditPlan.committee);
				$("tr[id^=agentType1]").css('display','none');
				$("tr[id^=agentType4]").css('display','none');
				
				//被保人是否为同一人
				if(creditPlan.is_same_person == "0"){
					$("#is_bundling_bbr").find("option[value="+creditPlan.is_bundling_bbr+"]").attr("selected",true);
					is_bundling_bbr_1();
				}
				
				//个人或企业客户
				var href = window.location.href.split(":")[1];
				$("#href").val(href);
				var custType = creditPlan.custType;
				if(custType != null && creditPlan.is_bundling_bbr == '1'){
					changeType(custType);
					$("input[type=radio][name=custType][value="+creditPlan.custType+"]").attr("checked",true)
					if(custType == '1'){//个人
						var identifyNo = creditPlan.identifyNo;
						if(identifyNo != null){
							$("#identifyNo").val(identifyNo);
							queryCustByIdentufyNo();
						}
					}else if(custType == '2'){
						var customerName = creditPlan.customerName;
						if(customerName != null){
							$("#customerName_qy").val(customerName);
						}
						var instituteCode = creditPlan.instituteCode;
						if(instituteCode != null){
							$("#instituteCode_qy").val(instituteCode);
						}
						var licenseCode = creditPlan.licenseCode;
						if(licenseCode != null){
							$("#licenseCode_qy").val(licenseCode);
						}
						queryCust();
					}
				}
				
				//是否电子保单
				if(creditProd.epolicyCode!=null&&creditProd.epolicyCode!=''){
					$("#iseplicyFlag").val(creditProd.epolicyCode+'-'+creditProd.epolicyName);
				}
				if(creditProd.epolicyName==null||creditProd.epolicyName==''){
					creditProd.epolicyName='未知';
				}
				$('#propTitle').html("电子保单模板："+creditProd.epolicyCode+'-'+creditProd.epolicyName)
				isDisable("agent_type", true);
				// 3、个人代理4、总对总代理 5、联合出单代理1、合作伙伴代理
				if("4"==creditPlan.agent_type){
					$("#quDaomessage").hide();
					if(!iscopy){
						queryAgentInfoRela4(1);
						mapBak.clear();//清空备份map
						var agentInfoList = data.agentInfoList;
						for(var i in agentInfoList){  
				        	var obj = new Object();
				        	obj.id = agentInfoList[i].ID;
				        	obj.commRate = agentInfoList[i].COMMRATE==null?"":agentInfoList[i].COMMRATE;
				        	map.put(obj.id,obj);
				        	mapBak.put(obj.id,obj);
				      	}
					}
					$("tr[id^=quDao0]").css('display','none');
					$("tr[id^=agentType4]").css('display','');
					$("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode102").append("<input type='hidden' id='dptCde'/>");
				}else{//合作伙伴代理
					isAgent();
					$('#emp_no').val(creditPlan.emp_no);
					$('#emp_name').val(creditPlan.emp_name);
					$('#team_code').val(creditPlan.team_code);
					$('#team_name').val(creditPlan.team_name);
					$('#companyCode').val(creditPlan.companyCode);
					$('#interMediary_code').val(creditPlan.interMediary_code);
					$('#interMediary_name').val(creditPlan.interMediary_name);
					$('#agreement_code').val(creditPlan.agreement_code);
					$('#service_code').val(creditPlan.service_code);
					$('#commission_charge').val(creditPlan.commission_charge);
					
					$("tr[id^=quDao0]").css('display','');
					$("tr[id^=agentType1]").css('display','');
					$("#deptCode101").empty();
					$("#deptCode102").empty();
					$("#deptCode101").append("出单机构：");
					$("#deptCode102").append("<input id='dept_code' readonly='readonly' style=' background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;&nbsp;<input type='button' class='input_button_2' value='请选择' onClick='openDeptDiv()' />");
					$('#dept_code').val(creditPlan.dept_code);
				}
				//状态字段的动态显示
				$('#status').val(creditPlan.status);
				if(flag){
					 	$('#status').val("0");
						$('input[onclick!="openAgentInfo3Div()"][onclick!="openAgentInfo4Div()"][onclick!="openAgentInfo5Div()"][onclick!="openAgentInfo6Div(1)"][onclick!="openAgentInfoZon4Div()"][onclick!="clearAgentInfoZon4Div()"]').attr("disabled",false);
						$('input').css("background-color","");
						$('select').attr("disabled",false);
						$('select').css("background-color","");
						$('#status').attr("disabled",true);
						$('#status').css("background-color","#ccc");
						$('textarea').attr("disabled",false);
						$('textarea').css("background-color","");
						$('#saveCreditPlanBtn').attr("disabled",false);
						$('#saveCreditPlanBtn').css("background-color","");
						$('#GoBackCreditPlanBtn').attr("disabled",false);
						$('#GoBackCreditPlanBtn').css("background-color","");
						$('#plan_code').attr("disabled",true);
						$('#plan_code').css("background-color","#ccc");
						$('#prod_code').attr("disabled",true);
						$('#prod_code').css("background-color","#ccc");
						$('#partner_code').attr("disabled",true);
						$('#partner_code').css("background-color","#ccc");
						$('#dept_code').attr("disabled",true);
						$('#dept_code').css("background-color","#ccc");
						isDisable("", true);
				}
				//争议解决方式
			    $("#contractSolution").val(creditPlan.contractSolution);
			    contractSolution1();
				if(creditPlan.contractSolution==0 && creditPlan.committee != null){
					$("#committee").val(creditPlan.committee);
				}
				//争议解决方式结束
				$('#special_arran').val(creditPlan.special_arran);
				$('#is_see_money').val(creditPlan.is_see_money);
				$('#is_epolicy').val(creditPlan.is_epolicy);
				
				if(creditPlan.is_see_money== "YD"){
					$("#_1").show();
				}
			}
		});
		
	}
	function contractSolution1(){
		var dicpute=$("#contractSolution").val();
		if(dicpute=='1'){
			$("#committee").attr("disabled",false);
			$("#committee").attr("style","");
			$("#committee_span").show();
		}else {
			$("#committee").val('');
			$("#committee").attr("disabled",true);
			$("#committee").attr("style","background-color:#ccc");
			$("#committee_span").hide();
		}
	}
	function clearNoNum1(event,obj){ 
		obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符   
		  obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的   
		  obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");  
		  obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数   
		  if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额  
		   obj.value= parseFloat(obj.value);  
		  }  	
	} 
	//统一 关闭  窗口
	function closeNocarAgentTypeDiv(obj){
		$("#"+obj).CloseDiv();	
	}
	//“归属渠道”改变时
	function changeChannleCode_QD(){
		var channleCode_QD = $.trim($("#channleCode_QD").val());
		loadSubCascadeList("channel_type",channleCode_QD,"channel_type");
		loadSubCascadeList("new_business_source","","new_bsns_type");
		$("#agent").hide();
		agentInfoWrite();
		 
	}
	//"渠道类型"改变时
	function changeChannleType(){
		var channel_type = $.trim($("#channel_type").val());
		loadSubCascadeList("new_business_source",channel_type,"new_bsns_type");
		$("#agent").hide();
		agentInfoWrite();
		 
	}
	
	//"业务来源"改变时
	function changenew_bsns_type(){
		var parentCode = $("#channel_type").val();
		var newBsnsCode = $("#new_bsns_type").val();
 		agentInfoWrite();
		isAgent();
	}
	//下拉框处理
	function loadSubCascadeList(codeType,parentCode,select_id){
		$.ajax({
			url : "<%=path%>/nlifePlanConfig/loadSubCascadeList?"+new Date().getTime(),
			type : 'POST',
			async : false,
			data:{codeType:codeType,parentCode:parentCode},
			dataType:'json',
			success:function(list){
				if($.validate(list))  return;
				var select = document.getElementById(select_id);
				select.options.length = 0;
				if (list != null) {
					for (var i = 0; i < list.length; i++) {
						var option = new Option();
						option.text = list[i].codeName;
						option.title = list[i].codeName;
						option.value = list[i].code;
						select.add(option);
					}
				}
	       	}
		});
	}
	
	//如果方案“状态”为有效，则方案整体页面内容为只读，不可修改（'状态'字段可编辑）；
	//如果方案再置位回无效，页面返回无效页面可读状态。
	function changeState(){
		var status = $.trim($('#status').val());	
	 	if(status=="1"){
	 		$('input').attr("disabled",true);
			$('input').css("background-color","#ccc");
			$('select').attr("disabled",true);
			$('select').css("background-color","#ccc");
			$('#status').attr("disabled",false);
			$('#status').css("background-color","");
			$('textarea').attr("disabled",true);
			$('textarea').css("background-color","#ccc");
			$('#saveCreditPlanBtn').attr("disabled",false);
			$('#saveCreditPlanBtn').css("background-color","");
			$('#GoBackCreditPlanBtn').attr("disabled",false);
			$('#GoBackCreditPlanBtn').css("background-color","");
		}else{
			$('input').attr("disabled",false);
			$('input').css("background-color","");
			$('select').attr("disabled",false);
			$('select').css("background-color","");
			$('textarea').attr("disabled",false);
			$('textarea').css("background-color","");
			$('#plan_code').attr("disabled",true);
			$('#plan_code').css("background-color","#ccc");
			$('#prod_code').attr("disabled",true);
			$('#prod_code').css("background-color","#ccc");
			$('#partner_code').attr("disabled",true);
			$('#partner_code').css("background-color","#ccc");
			$('#dept_code').attr("disabled",true);
			$('#dept_code').css("background-color","#ccc");
		}
	} 
	//点击"请选择(产品)" 弹出产品选择层
	function openCreditProdDiv(){
		//加载第一页产品信息
		queryCreditProd(1);
	}
	
	//加载产品信息前，拼接参数
	function queryCreditProd(pageIndex){
		var size = 8;
		var prod_code = $.trim($('#prod_code_choose').val());
		var prod_name = $.trim($('#prod_name_choose').val());
		var DateReg = /^(\d{4})\-(\d{2})\-(\d{2})$/;
		var startDateBegin = $.trim($('#startDateBegin').val());
		var startDateEnd = $.trim($('#startDateEnd').val());
		var sflag = DateReg.test(startDateBegin);
		var eflag = DateReg.test(startDateEnd);
		if(null != startDateBegin && "" != startDateBegin){
			if(!sflag){
				$.message("error", "您输入的定义起期格式不正确，格式为：YYYY-MM-DD。请重新选择日期");
				$('#startDateBegin').val('');
				return;
			}
		}
		if(null != startDateEnd && "" != startDateEnd){
			if(!eflag){
				$.message("error", "您输入的定义止期格式不正确，格式为：YYYY-MM-DD。请重新选择日期");
				$('#startDateEnd').val('');
				return;
			}
		}
		loadCreditProd({size:size,current:pageIndex,prodCode:prod_code,prodName:prod_name,startDateBegin:startDateBegin,startDateEnd:startDateEnd});
	}
	
	//根据传入的参数，加载相应的产品
	function loadCreditProd(param){
		$.openLoading();
		$.ajax({
			url : "<%=path%>/CreditPlan/queryCreditProdPageByCriteria?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(page){
				$.closeLoading();
				if($.validate(page))return;

				var radioObj ="<input class='input_fxk' name='radioCreditProd' type='radio'/>";
				var fieldNames = "prodCode,prodName,agentType@TDH";
				var tableContent = creatTable1(fieldNames,page,radioObj);
				var tableObj = $("#creditProdTable");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage(param.current,6,page.maxPage,"84");
				var pageDIV = $("#creditProdPageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$("#creditProdDiv").OpenDiv();

				bindradio();
			}
		});
	}
	//点击“确定”按钮，选择产品
	function chooseCreditProd(){
		var selected = $("input[name='radioCreditProd']:checked");
		if(selected.length==0){
			$.message("error", "请选择一个产品");
			return;
		}
		/**产品配置的电子保单模板*/
		var iseplicyFlag=selected.parent().parent().children(" td:eq(4)").html();
		if(iseplicyFlag=='-'){
			iseplicyFlag='';
		}
		if($('#is_epolicy').val()=='Y'){
			if(iseplicyFlag==''){
				$.message("error", "【是否电子保单】选中是本产品未配置电子保单模板");
				return;
			}else{
				$('#propTitle').html("电子保单模板："+iseplicyFlag);
			}
		} 
		var prod_code_current = $.trim($('#prod_code').val());
		
		var prod_code = selected.parent().parent().children(" td:eq(1)").html();
		var prod_name = selected.parent().parent().children(" td:eq(2)").html();
		$('#prod_code').val(prod_code);
		$('#prod_name').val(prod_name);
		var prodSaleCode = selected.parent().parent().children(" td:eq(4)").html();
		$('#prodSaleCode').val(prodSaleCode);//该值是为了向销管获取代理信息时传参
			$("#iseplicyFlag").val(iseplicyFlag)
		
/* 		var agent_type = selected.parent().parent().children(" td:eq(3)").html();
		$("#agent_type").val(agent_type); */
		if(prod_code != prod_code_current && iscopy !=true){//如果产品更换
			agentInfoWrite();
		}
		closeCreditProdDiv();
	}
	/**是否可以录入*/
	function isDisable (obj,flag){
		//可用
		if(!flag){
			$("#"+obj).attr("disabled",false);
			$("#"+obj).css({"background-color": ""});
		}else{
			//不可用
			$("#"+obj).attr("disabled",true);
			$("#"+obj).css({"background-color": "#ccc"});
		}
	}
	//关闭 选择产品 弹出层
	function closeCreditProdDiv(){
		$("#creditProdDiv").CloseDiv();	
		$('#prod_code_choose').val("");
		$('#prod_name_choose').val("");
		$('#startDateBegin').val("");
		$('#startDateEnd').val("");
	}
	
	//点击"请选择(合作伙伴)" 弹出合作伙伴选择层
	function openChannelInfoDiv(){
		//必须先选择产品，在选择合作伙伴
		if(($.trim($('#prod_code').val())).length==0){
			$.message('error',"请先选择产品");
			return;
		}
		
		//加载第一页合作伙伴信息
		queryChannelInfo(1);
	}
	
	//加载合作伙伴信息前，拼接参数
	function queryChannelInfo(pageIndex){
		var size = 8;
		var channelCode = $.trim($('#channelCode_choose').val());
		var channelName = $.trim($('#channelName_choose').val());
		
		loadChannelInfo({size:size,current:pageIndex,channelCode:channelCode,channelName:channelName});
	}
	
	//根据传入的参数，加载相应的合作伙伴
	function loadChannelInfo(param){
		$.openLoading();
		$.ajax({
			url : "<%=path%>/CreditPlan/queryChannelInfoPageByCriteria?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(page){
				$.closeLoading();
				if($.validate(page))return;
	
				var radioObj ="<input class='input_fxk' name='radioChannelInfo' type='radio' value=''>";
				var fieldNames = "channelCode,channelName,deptCode@TDH,thirdPlan@TDH";
				var tableContent = creatTable1(fieldNames,page,radioObj);
				var tableObj = $("#channelInfoTable");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage2(param.current,6,page.maxPage,"42");
				var pageDIV = $("#channelInfoPageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$('#channelInfoDiv').OpenDiv();
				
				bindradio();
			}
		});
	}
	
	//点击“确定”按钮，选择合作伙伴
	function chooseChannelInfo(){
		var partner_code = $.trim($("#partner_code").val());
		
		var selected = $("input[name='radioChannelInfo']:checked");
		if(selected.length==0){
			$.message("error", "请选择一个合作伙伴");
			return;
		}
		var channelCode = selected.parent().parent().children("td:eq(1)").html();
		var deptCode = selected.parent().parent().children("td:eq(3)").html();
		var thirdPlan = selected.parent().parent().children("td:eq(4)").html();
		var dept_code=$.trim($("#dept_code").val());
		$('#partner_code').val(channelCode);
		$('#isThirdPlan').val(thirdPlan);
		//合作伙伴 改变，同步改变 出单机构等
		if(partner_code != channelCode){
			//代理信息
			$("#agentInfoRela4Table").find("tbody").remove();
			$("#agentInfoRela4PageDIV").innerHTML="";
			if(iscopy !=true){
				mapBak.clear();
				map.clear();
			}
		}
		closeChannelInfoDiv();
		//清空出单机构
		if((dept_code.length>0 && dept_code.substring(0,2)!=deptCode)){
			$("#dept_code").val("");
			$('#sale1').hide();
			$('#sale2').hide();
		}

	}
	
	//关闭 选择合作伙伴 弹出层
	function closeChannelInfoDiv(){
		$("#channelInfoDiv").CloseDiv();	

		$('#channelCode_choose').val("");
		$('#channelName_choose').val("");
	}
	
	//点击"请选择(出单机构)" 弹出出单机构选择层
	function openDeptDiv(){
		//必须先选择合作伙伴，在选择出单机构
		if(($.trim($('#partner_code').val())).length==0){
			$.message('error',"请先选择合作伙伴代码");
			return;
		}
		
		//加载第一页出单机构
		queryDept(1);
	}
	
	//加载出单机构信息前，拼接参数
	function queryDept(pageIndex){
		var size = 8;
		var partner_code = $.trim($('#partner_code').val());
		var deptCode = $.trim($('#deptCode_choose').val());
		var deptCname = $.trim($('#deptCname_choose').val());
		
		loadDept({size:size,current:pageIndex,deptCode:deptCode,deptCname:deptCname,partner_code:partner_code});
	}
	
	//根据传入的参数，加载相应的出单机构
	function loadDept(param){
		$.openLoading();
		$.ajax({
			url : "<%=path%>/CreditPlan/queryDeptPageByCriteria?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(page){
				$.closeLoading();
				if($.validate(page))return;
	
				var radioObj ="<input class='input_fxk' name='radioDept' type='radio'/>";
				var fieldNames = "deptCode,deptCNname";
				var tableContent = creatTable1(fieldNames,page,radioObj);
				var tableObj = $("#deptTable");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage3(param.current,6,page.maxPage,"44");
				var pageDIV = $("#deptPageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				$('#deptDiv').OpenDiv();
				bindradio();
			}
		});
	}
	
	//点击“确定”按钮，选择出单机构
	function chooseDept(){
		var dept_code_current = $.trim($('#dept_code').val());
		
		var selected = $("input[name='radioDept']:checked");
		if(selected.length==0){
			$.message("error", "请选择一个出单机构");
			return;
		}
		var dept_code = selected.parent().parent().children(" td:eq(1)").html();
		$('#dept_code').val(dept_code);
		closeDeptDiv();
	}
	
	//关闭 选择出单机构 弹出层
	function closeDeptDiv(){
		$("#deptDiv").CloseDiv();	

		$('#deptCode_choose').val("");
		$('#deptCname_choose').val("");
	}
	
	//绑定单选按钮事件，选中某个单选按钮，该按钮所在行高亮显示
	function bindradio(){
		$("input[name='radioCreditProd']").click(function(){
			$("input[name='radioCreditProd']").parent().parent().removeClass("table_highlighter");
			$(this).parent().parent().addClass("table_highlighter");
	   	});
		$("input[name='radioChannelInfo']").click(function(){
			$("input[name='radioChannelInfo']").parent().parent().removeClass("table_highlighter");
			$(this).parent().parent().addClass("table_highlighter");
	   	});
		$("input[name='radioDept']").click(function(){
			$("input[name='radioDept']").parent().parent().removeClass("table_highlighter");
			$(this).parent().parent().addClass("table_highlighter");
	   	});
		$("input[name='agentInfo4checkbox']").click(function(){
			var id= $(this).parent().parent().children("td:eq(1)").html();
			if($(this).prop("checked")){//选中
				$(this).parent().parent().addClass("table_highlighter");
				var obj = new Object();
				var columnes=$("#agentInfo4Table").find("th").length;
				var commRate_Div= $(this).parent().parent().find("input[name='commRate_Div']").val();
				obj.id =id;
				obj.commRate= commRate_Div;
				map.put(obj.id,obj);
			}else{//取消选中
				$(this).parent().parent().removeClass("table_highlighter");
				$(this).prop("checked",false);
				map.remove(id);
			}
	   	});
		$("input[name='agentInfoZon4checkbox']").click(function(){
			var branch= $(this).parent().parent().children(" td:eq(1)").html();
			if($(this).prop("checked")){//选中
				$(this).parent().parent().addClass("table_highlighter");
				var commRate= $(this).parent().parent().children("td:eq(7)").find('input').val();
				var o=new Object();
				o.commRate=commRate;
				o.branch=branch;
				zonMap.put(branch, o);
			}else{//取消选中
				$(this).parent().parent().removeClass("table_highlighter");
				$(this).prop("checked",false);
				zonMap.remove(branch);
			}
	   	});
		$("#agentInfo4CheckAll").click(function(){
			if($(this).prop("checked")){//选中
				$("#agentInfo4Table tbody tr").each(function() {
					$(this).find("input[name='agentInfo4checkbox']").prop("checked",true);
					$(this).addClass("table_highlighter");
					var obj = new Object();
					obj.id = $(this).children("td:eq(1)").html();
					var columnes=$("#agentInfo4Table").find("th").length;
					obj.commRate = $(this).find("input[name='commRate_Div']").val();
					map.put(obj.id,obj);
				});
			}else{//取消选中
				$("#agentInfo4Table tbody tr").each(function() {
					$(this).removeClass("table_highlighter");
					$(this).find("input[name='agentInfo4checkbox']").prop("checked",false);
					var id= $(this).children("td:eq(1)").html();
					map.remove(id);
				});
			}
		});
	}
	function zonRateChange(obj){
		var rate=$(obj).attr("name");
		var branch= $(obj).parent().parent().children(" td:eq(1)").html();
		var o=zonMap.get(branch);
		if(o){
			//手续费比例
			if("commRate_Zon"==rate){
				o.commRate= $(obj).val()+"";
			}
			zonMap.put(branch,o);
		}
	}
	var branchs='';

	//代理人代码、代理协议号可输入状态
	function agentInfoWrite(){
		$('#interMediary_code_select_div').css('display','none').val("");
		$('#interMediary_code').show().val('');
		
		$('#agreement_code').attr("readonly",false).css('background-color','white').val('');
		$("#commRateSpan").empty();
		
		$('#feeMinRate').val("0");
		$('#feeMaxRate').val('1');
	}
	//“保存”按钮（添加/编辑方案）
	function checkAndExcute(flag){
		var plan_code = $.trim($('#plan_code').val());
		var plan_name = $.trim($('#plan_name').val());
		/**是否上线产品*/
		var isProprod=false;
		if($("#isProprod").is(':checked')){
			isProprod=true;
		}
		if(plan_name.length==0){
			$.message("error", "请输入方案名称");
			$('#plan_name').focus();
			return;
		}
		var prod_code = $.trim($('#prod_code').val());
		if(prod_code.length==0){
			$.message("error", "请选择产品代码");
			$('#prod_code').focus();
			return;
		}
		var partner_code = $.trim($('#partner_code').val());
		if(partner_code.length==0){
			$.message("error", "请选择合作伙伴代码");
			$('#partner_code').focus();
			return;
		}
		var setProjectCode = $.trim($('#setProjectCode').val());
		if(setProjectCode.length==0){
			$.message("error", "请输入立项代码");
			$('#setProjectCode').focus();
			return;
		}
		var setProjectName = $.trim($('#setProjectName').val());
		if(setProjectName.length==0){
			$.message("error", "请输入立项名称");
			$('#setProjectName').focus();
			return;
		}
		var premium = $.trim($('#premium').val());
		if(premium.length!=0){
			var reg = /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/;
			if(!reg.test(premium)){
				$.message("error", "保费格式不正确，请重新输入");
				$('#premium').focus();
				return;
			}
		}
		var jurisdictionRight = $.trim($('#jurisdictionRight').val());
		if(jurisdictionRight.length==0){
			$.message("error", "请输入司法管辖权");
			$('#jurisdictionRight').focus();
			return;
		}
		var chargerCode = $.trim($('#chargerCode').val());
		if(chargerCode.length==0){
			$.message("error", "请输入操作人");
			$('#chargerCode').focus();
			return;
		}
		var comCode = $.trim($('#comCode').val());
		if(comCode.length==0){
			$.message("error", "请输入操作人归属机构");
			$('#comCode').focus();
			return;
		}
		var review_the_rules = $.trim($('input[name="review_the_rules"]:checked').val());
		if(review_the_rules.length==0){
			$.message("error", "请选择审核规则");
			$("#review_the_rules").focus();
			return;
		}
		var underWriting_rule = $.trim($('input[name="underWritingRule"]:checked').val());
		var channleCode_QD = $.trim($('#channleCode_QD').val());
		var channel_type = $.trim($('#channel_type').val());
		var new_bsns_type = $.trim($('#new_bsns_type').val());
		var agent_type= $.trim($("#agent_type").val());
		//1、合作伙伴代理3、个人代理4、总对总代理
		var dept_code = $.trim($('#dept_code').val());
		var companyCode = $.trim($('#companyCode').val());
		var team_name = $.trim($('#team_name').val());
		var team_code = $.trim($('#team_code').val());
		var emp_no = $.trim($('#emp_no').val());
		var emp_name = $.trim($('#emp_name').val());
		var service_code = $.trim($('#service_code').val());
		var interMediary_code = $.trim($("#interMediary_code").val());
		var interMediary_name = $.trim($("#interMediary_name").val());
		var commRate = $.trim($("#commRate").val());
		var commission_charge = $.trim($("#commission_charge").val());
		var agreement_code = $.trim($("#agreement_code").val());
		if(agent_type == "1"){
			if(channleCode_QD.length==0){
				$.message("error", "请选择渠道名称");
				$('#channleCode_QD').focus();
				return;
			}
			if(channel_type.length==0){
				$.message("error", "请选择渠道类型");
				$('#channel_type').focus();
				return;
			}
			if(new_bsns_type.length==0){
				$.message("error", "请选择业务来源");
				$('#new_bsns_type').focus();
				return;
			}
			if(dept_code.length==0){
				$.message("error", "请选择出单机构");
				$('#dept_code').focus();
				return;
			}
			if(companyCode.length==0){
				$.message("error", "请输入经办人归属机构代码");
				$('#companyCode').focus();
				return;
			}
			if(team_name.length==0){
				$.message("error", "请输入经办人所属团队名称");
				$('#team_name').focus();
				return;
			}
			if(team_code.length==0){
				$.message("error", "请输入经办人所属团队代码");
				$('#team_code').focus();
				return;
			}
			if(emp_no.length==0){
				$.message("error", "请输入经办人代码");
				$('#emp_no').focus();
				return;
			}
			if(emp_name.length==0){
				$.message("error", "请输入业务员名称");
				$('#emp_name').focus();
				return;
			}
			if(service_code.length==0){
				$.message("error", "请输入服务代码");
				$('#service_code').focus();
				return;
			}
			
			var options=$("#new_bsns_type option:selected").text();
			if(options.match("代理")){
				//代理信息
				if(interMediary_code.length==0){
					$.message("error", "请输入代理人编码");
					$('#interMediary_code').focus();
					return;
				}
				if(interMediary_name.length==0){
					$.message("error", "请输入代理人名称");
					$('#interMediary_name').focus();
					return;
				}
				if(commRate.length==0){
					$.message("error", "请输入手续费比例（%）");
					$('#commRate').focus();
					return;
				}else{
					//小数点. 后面最多保留4位小数，根据数据库 手续费比例精度（20,4)
				    var reg=/^0(\.\d{0,6})?$/;
				    if(!reg.test(commRate)){
				    	$('#commRate').focus();
				    	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
				    	return;
				    }
				   var feeMaxRate = $.trim($('#feeMaxRate').val());
				   var feeMinRate = $.trim($('#feeMinRate').val());
				   if(commRate > feeMaxRate){
					    $('#commRate').focus();
				    	$.message("error","手续费比例：超过上限");
				    	return;
				   }
				   if(commRate < feeMinRate){
					    $('#commRate').focus();
				    	$.message("error","手续费比例：低于下限");
				    	return;
				   }
				}
				
				if(commission_charge.length!=0){
					var reg= /^[+]{0,1}(\d+)$|^[+]{0,1}(\d+\.\d+)$/;
				    if(!reg.test(commission_charge)){
				    	$('#commission_charge').focus();
				    	$.message("error","手续费（元）格式不正确，请重新输入");
				    	$('#commission_charge').focus();
				    	return;
				    }
				}
				if(agreement_code.length==0){
					$.message("error", "请输入代理协议号");
					$('#agreement_code').focus();
					return;
				}
			}	
		}
		var status = $.trim($('#status').val());
		if('4'==agent_type){
			if(flag=="add"){
			if(status=='1'){//状态为有效
					$.message("error", "销售业务信息为空,保存方案并配置代理信息后才能修改为有效");
					return; 
				} 
			}
			if(flag=="update"){
				if(status=='1'){//状态为有效
					if(mapBak.isEmpty()){
						$.message("error", "销售业务信息为空,配置代理信息后才能修改为有效");
						return;
					}	
				}
			}
			if(flag=="copyAdd"){
				if(status=='1'){//状态为有效
					if(oldAgentType==agent_type && oldPartnerNo==partner_code){
						if(mapBak.isEmpty()){
							$.message("error", "原方案未配置销售业务信息,该方案不能置为有效");
							return;
						}
					}else{
						$.message("error", "产品销售类型更改或合作伙伴更改,改方案不能置为有效");
						return;
					}
				}
			}
		}
		
		//是否电子保单
		var is_epolicy_val = $.trim($('#is_epolicy').val());
		var DownloadWay_val='';
		if(is_epolicy_val==''){
			 $.message("error", "请选择是否电子保单");
			return;
		}
		
		//是否见费出单
		var is_see_money = $.trim($('#is_see_money').val());
		var special_arran = $.trim($('#special_arran').val());
		var arr='';
		var arr1 = new Array(); 
	    if(flag!="update"){
			var sale=dept_code.substring(0,2);
			if(sale=='44'){
				for (var i = 1; i <= 5; i++) {
					if(salemap.get(i)){
						arr1.push(salemap.get(i));
					}
				}
				 arr=JSON.stringify(arr1);
			}
	    }
	    //争议解决方式
	    var contractSolution=$.trim($('#contractSolution').val());
	    var committee=$.trim($('#committee').val());
	    if(contractSolution!='1'){
	    	committee="";
	    }
	    //被保人信息
	    //被保人是否为同一人
	    var is_same_person = $("#is_same_person").val(); 
	    //是否固化
	    var is_bundling_bbr='';
	    //客户类型
	    var custType = '';
	    if(is_same_person == '0'){
	    	is_bundling_bbr = $("#is_bundling_bbr").val(); 
	    	custType = $('input[name=custType]:checked').val(); 
	    }
	    var bbr_credit_code = '';//客户代码
	    if(is_bundling_bbr == '1'){
	    	if(custType == '1'){//个人客户类型
	    		bbr_credit_code = $.trim($('#customerCode_1').html());
	    		if(bbr_credit_code=='&nbsp;'){
	    			$.message("error", "请填写相应的信息，进行个人客户查询");
					$('#identifyNo').focus();
					return;
	    		}
	    	}else if(custType == '2'){//企业客户类型
	    		bbr_credit_code = $.trim($('#customerCode_2').html());
	    		if(bbr_credit_code=='&nbsp;'){
	    			$.message("error", "请填写相应的信息，进行企业客户查询");
					$('#licenseCode_qy').focus();
					return;
	    		}
	    	}
	    }
	    var franchiserate = $.trim($('#franchiserate').val());
	  	if(franchiserate.length!=0){
	   		var reg=/^0(\.\d{0,6})?$/;
		    if(!reg.test(franchiserate)){
		    	$('#franchiserate').focus();
		    	$.message("error","免赔率(%)：只能录入0到1之间的有效数字(最多6位小数)");
		    	return;
		    }
		}
	  	var compenSationRatio = $.trim($('#compenSationRatio').val());
	  	if(compenSationRatio.length!=0){
	   		var reg=/^0(\.\d{0,6})?$/;
		    if(!reg.test(compenSationRatio)){
		    	$('#compenSationRatio').focus();
		    	$.message("error","赔偿比例(%)：只能录入0到1之间的有效数字(最多6位小数)");
		    	return;
		    }
		}
	    var waitingPeriod = $.trim($('#waitingPeriod').val());
	    if(waitingPeriod.length!=0){
		    var reg = /^[+]{0,1}(\d+)$/;
			if(!reg.test(waitingPeriod)){
				$.message("error", "赔偿等待期格式不正确，请重新输入");
				$('#waitingPeriod').focus();
				return;
			}
		}
	    var isInternetps = $.trim($('#isInternetps').val());
	    var is_pool = $.trim($('#is_pool').val());
	    var businessTypes = $.trim($('#businessTypes').val());
	    var farmFlag = $.trim($('#farmFlag').val());
	    var businessClass = $.trim($('#businessClass').val());
	    var projectType= $.trim($("#projectType").val());
	    
	    var identifyNo = $("#identifyNo").val();
	    var licenseCode = $("#licenseCode_qy").val();
	    var customerName = $("#customerName_qy").val();
	    var instituteCode = $("#instituteCode_qy").val();
	    if(flag=="add"){
			excuteAdd({contractSolution:contractSolution,committee:committee,planType:'3',
				saleArry:arr,plan_name:plan_name,prod_code:prod_code,partner_code:partner_code,channel_code:channleCode_QD,channel_type:channel_type,
					   new_bsns_type:new_bsns_type,dept_code:dept_code,commRate:commRate,emp_no:emp_no,emp_name:emp_name,
					   team_code:team_code,team_name:team_name,interMediary_code:interMediary_code,agreement_code:agreement_code,service_code:service_code,
					   status:status,is_epolicy:is_epolicy_val,is_see_money:is_see_money,review_the_rules:review_the_rules,underWriting_rule:underWriting_rule,
					   setProjectCode:setProjectCode,setProjectName:setProjectName,premium:premium,jurisdictionRight:jurisdictionRight,chargerCode:chargerCode,
					   comCode:comCode,companyCode:companyCode,interMediary_name:interMediary_name,commission_charge:commission_charge,
					   franchiserate:franchiserate,compenSationRatio:compenSationRatio,waitingPeriod:waitingPeriod,isInternetps:isInternetps,
					   is_pool:is_pool,businessTypes:businessTypes,farmFlag:farmFlag,businessClass:businessClass,projectType:projectType,
					   special_arran:special_arran,is_same_person:is_same_person,is_bundling_bbr:is_bundling_bbr,custType:custType,bbr_credit_code:bbr_credit_code,
					   epolicyDownloadWay:DownloadWay_val,
					   agent_type:agent_type,isProprod:isProprod,
					   identifyNo:identifyNo,licenseCode:licenseCode,customerName:customerName,instituteCode:instituteCode});
		}
		if(flag=="update"){
			excuteUpdate({contractSolution:contractSolution,committee:committee,plan_code:plan_code,
						  plan_name:plan_name,prod_code:prod_code,partner_code:partner_code,channel_code:channleCode_QD,channel_type:channel_type,
				          new_bsns_type:new_bsns_type,dept_code:dept_code,commRate:commRate,emp_no:emp_no,emp_name:emp_name,
				          team_code:team_code,team_name:team_name,interMediary_code:interMediary_code,agreement_code:agreement_code,service_code:service_code,
				          status:status,is_epolicy:is_epolicy_val,is_see_money:is_see_money,review_the_rules:review_the_rules,underWriting_rule:underWriting_rule,
				          setProjectCode:setProjectCode,setProjectName:setProjectName,premium:premium,jurisdictionRight:jurisdictionRight,chargerCode:chargerCode,
						  comCode:comCode,companyCode:companyCode,interMediary_name:interMediary_name,commission_charge:commission_charge,
						  franchiserate:franchiserate,compenSationRatio:compenSationRatio,waitingPeriod:waitingPeriod,isInternetps:isInternetps,
						  is_pool:is_pool,businessTypes:businessTypes,farmFlag:farmFlag,businessClass:businessClass,projectType:projectType,
						  special_arran:special_arran,is_same_person:is_same_person,is_bundling_bbr:is_bundling_bbr,custType:custType,bbr_credit_code:bbr_credit_code,
						   epolicyDownloadWay:DownloadWay_val,
						   agent_type:agent_type,
						   identifyNo:identifyNo,licenseCode:licenseCode,customerName:customerName,instituteCode:instituteCode});
		}
		if(flag=="copyAdd"){
			excuteAdd({contractSolution:contractSolution,committee:committee,planType:'3',
				saleArry:arr,oldplan_code:plan_code,oldAgentType:oldAgentType,oldPartnerNo:oldPartnerNo,
				       plan_name:plan_name,prod_code:prod_code,partner_code:partner_code,channel_code:channleCode_QD,channel_type:channel_type,
				       new_bsns_type:new_bsns_type,dept_code:dept_code,commRate:commRate,emp_no:emp_no,emp_name:emp_name,
				       team_code:team_code,team_name:team_name,interMediary_code:interMediary_code,agreement_code:agreement_code,service_code:service_code,
				       status:status,is_epolicy:is_epolicy_val,is_see_money:is_see_money,review_the_rules:review_the_rules,underWriting_rule:underWriting_rule,
				       setProjectCode:setProjectCode,setProjectName:setProjectName,premium:premium,jurisdictionRight:jurisdictionRight,chargerCode:chargerCode,
					   comCode:comCode,companyCode:companyCode,interMediary_name:interMediary_name,commission_charge:commission_charge,
					   franchiserate:franchiserate,compenSationRatio:compenSationRatio,waitingPeriod:waitingPeriod,isInternetps:isInternetps,
					   is_pool:is_pool,businessTypes:businessTypes,farmFlag:farmFlag,businessClass:businessClass,projectType:projectType,
					   special_arran:special_arran,is_same_person:is_same_person,is_bundling_bbr:is_bundling_bbr,custType:custType,bbr_credit_code:bbr_credit_code,
					   epolicyDownloadWay:DownloadWay_val,
					   agent_type:agent_type,isProprod:isProprod,
					   identifyNo:identifyNo,licenseCode:licenseCode,customerName:customerName,instituteCode:instituteCode});
 			}
		}
	//执行添加（新增/复制新增）
	function excuteAdd(param){
		$.openLoading();
		$.ajax({
			url : "<%=path%>/CreditPlan/addOrUpdateCreditPlan?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(result){
				$.closeLoading();
				if($.validate(result))return;
				
				var returnMap = result.data;
				if(returnMap.agent_type=="1"){
					successBack('add');
				}else if(returnMap.agent_type=="3" || returnMap.agent_type=="4"||returnMap.agent_type=="5"){
					window.location.href='<%=path%>/CreditPlan/toEditCreditPlan?plan_code='+returnMap.plan_code;
				}else{
					successBack('add');
				}
			}
		});
	}
	
	//执行修改
	function excuteUpdate(param){
		$.openLoading();
		$.ajax({
			url : "<%=path%>/CreditPlan/addOrUpdateCreditPlan?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(data){
				$.closeLoading();
				if($.validate(data))return;
				successBack('edit');
			}
		});
	}
	
	//添加/编辑成功后返回主页面
	function successBack(flag){
		window.location.href = "<%=path%>/CreditPlan/successBack?flag="+flag;
	}
	
	
	//“返回”按钮
	function goBackToList(){
		window.location.href='<%=path%>/CreditPlan/list';
	}

<%--***************************************************** --%>
	//加载总对总代理(agent_type==4)代理信息前，拼接参数
	function queryAgentInfoRela4(pageIndex){
		var size = 5;
		var plan_code = $.trim($('#plan_code').val());
		var agent_type ="4";
		loadAgentInfoRela4({size:size,current:pageIndex,plan_code:plan_code,agentType:agent_type});
	}
	//加载总对总代理信息
	function loadAgentInfoRela4(param){
		$.ajax({
			url : "<%=path%>/CreditPlan/queryAgentInfoRelaPageByCriteria?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(page){
				$.closeLoading();
				var fieldNames;
				var flang=false;
				if($.validate(page))return;
					$.each(page.data, function(k, v){
					 if(v.TRANSTYPE=='1'){
						 flang=true;
					 }
					 return false; 
					});
					if(page.data==''){
						flang=true;
					}
				fieldNames = "AGENT_TYPE@TDH,CODE_NAME,CHANNEL_CODE@TDH,CHANNEL_NAME,BRANCH_NAME,BRANCH,DPT_CDE,CHANNLECODE@TDH,CHANNLECODEDES,CHANNLETYPE@TDH,CHANNLETYPEDES,NEWBSNSTYPE@TDH,NEWBSNSTYPEDES,AGENT_NO,C_BRKR_NME,PROTOCOL_NO,SERVICE_CODE,EMP_NAME,MANAG_CODE,MANAG,TEAM_CODE,TEAM_NAME,ID@TDH,TRANS_TYPE@TDH,EMP_NO@TDH,comm_rate";
				$("#agentInfoRela4Table tr:eq(1) td:eq(0)").attr("colspan",21).siblings().remove();
				var tableContent = creatTable1(fieldNames,page);
				var tableObj = $("#agentInfoRela4Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage3(param.current,6,page.maxPage,"46");
				var pageDIV = $("#agentInfoRela4PageDIV");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
			}
		});
	}
	//点击"配置总对总销售业务信息", 弹出总对总代理信息选择层
	function openAgentInfo4Div(){
		//加载第一页总对总代理信息
		queryAgentInfo4(1);
	}
	//加载总对总代理信息前，拼接参数
	function queryAgentInfo4(pageIndex){
		var plan_code = $.trim($('#plan_code').val());
		if(plan_code.length==0){
			$.message("error", "请先保存投保方案");
			return;
		}
		var partner_code = $.trim($("#partner_code").val());
		if(plan_code.length==0){
			$.message("error", "请先选择合作伙伴代码");
			return;
		}
		
		var selectedAgentInfo4 = $("input[name='agentInfo4checkbox']:checked");
		if(selectedAgentInfo4.length!=0){
			var flag= false;
			selectedAgentInfo4.each(function(i){
				var obj=$(this).parent().parent().find("input[name='commRate_Div']");
				var commRate= $.trim(obj.val());
				if(commRate!=""){
					var reg=/^0(\.\d{0,6})?$/;
			        if(!reg.test(commRate)){
			        	flag = true;
			        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
			        	window.setTimeout(function(){ obj.focus(); }, 0);
			        	return false; 
			        }
			    }
			});
			if(flag){
				return;
			}
		}
		if(selectedAgentInfo4.length!=0){
			selectedAgentInfo4.each(function(i){
				var obj = new Object();
			    var columnes=$("#agentInfo4Table").find("th").length;
			    if(columnes==22){
					obj.id= $(this).parent().parent().children("td:eq(1)").html();
			    }else if(columnes==23){
			    	obj.id= $(this).parent().parent().children("td:eq(1)").html();
			    }
				obj.branch= $(this).parent().parent().children("td:eq(7)").html();
				obj.commRate= $(this).parent().parent().find("input[name='commRate_Div']").val();
				map.put(obj.id,obj);
			});
		}
		
		var agent_type = '4';
		var size = 10;
		
		var confStatus = $.trim($("#confStatus_4").val());
		var branch = $.trim($("#branch").val());
		var branchName = $.trim($("#branchName").val());
		
		loadAgentInfo4({size:size,current:pageIndex,plan_code:plan_code,partner_code:partner_code,agent_type:agent_type,confStatus:confStatus,branch:branch,branchName:branchName});
	}
	//加载区域总对总代理信息前，拼接参数
	function queryAgentInfoZon4(pageIndex){
		var plan_code = $.trim($('#plan_code').val());
		if(plan_code.length==0){
			$.message("error", "请先保存投保方案");
			return;
		}
		var partner_code = $.trim($("#partner_code").val());
		if(plan_code.length==0){
			$.message("error", "请先选择合作伙伴代码");
			return;
		}
		var agent_type = '4';
		var size = 10;
		var branchName = $.trim($("#ZonbranchName").val());
		var ZonconfStatu=$.trim($("#ZonconfStatus_4").val());
		loadAgentInfoZon4({size:size,current:pageIndex,plan_code:plan_code,partnerNo:partner_code,isFlag:ZonconfStatu,branchName:branchName});
	}
	//加载区域总对总代理信息
	function loadAgentInfoZon4(param){
		$.openLoading();
		$.ajax({							
			url : "<%=path%>/CreditPlan/queryAgentInfoZon4PageByCriteria?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(page){
				var flang=false;
				var fieldNames ;
				$.closeLoading();
				if($.validate(page))return;
				fieldNames = "DEP,DEPT_ABR,ISFLAG@TDH,MCOMMRATE@TDH,LMARKET@TDH,MBUSINESS@TDH";
				var checkboxObj ="<input name='agentInfoZon4checkbox' type='checkbox'>";
				var inputObj ="<input style='width:100%' name='commRate_Zon' onchange='zonRateChange(this)'/>";
				var tableContent = creatTable1(fieldNames,page,checkboxObj,inputObj);
				var tableObj = $("#agentInfoZon4Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage4(param.current,6,page.maxPage,"71");
				var pageDIV = $("#agentInfoZon4Page");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$("#agentInfoZon4Table").find("tr").each(function(){
					var branch=$(this).children("td:eq(1)").html();
					var isFlag=$(this).children("td:eq(3)").html();
					var commRate=$(this).children("td:eq(4)").html();
					if(isFlag=='Y'){
						$(this).addClass("table_highlighter");
						$(this).children("td:eq(0)").find("input[name='agentInfoZon4checkbox']").prop("checked",true);
						if(commRate==-1){
							commRate='';
						}
						var o=new Object();
						o.branch=branch;
						o.commRate=commRate;
						if(branchs==''){
							branchs=branch;
						}else{
							branchs+=","+branch;
						}
						zonMap.put(branch,o);
						$(this).find("input[name='commRate_Zon']").val(commRate);
					}
				});
				$('#agentInfoZon4Div').OpenDiv();
				bindradio();
			}
		});
	}
	//加载区域总对总结束
	//加载总对总代理信息
	function loadAgentInfo4(param){
		$.openLoading();
		$.ajax({							
			url : "<%=path%>/CreditPlan/queryAgentInfoPageByCriteria?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(page){
				var flang=false;
				var fieldNames ;
				$.closeLoading();
				if($.validate(page))return;
				$.each(page.data, function(k, v){
					 if(v.TRANSTYPE=='1'){
						 flang=true;
					 }
					 return false; 
					});
			
				var checkboxObj ="<input name='agentInfo4checkbox' type='checkbox'>";
				fieldNames = "ID@TDH,AGENT_TYPE@TDH,CODE_NAME,CHANNEL_CODE@TDH,CHANNEL_NAME,BRANCH_NAME,BRANCH,DPT_CDE,CHANNLECODEDES,CHANNLETYPEDES,newbsnstypedes,agent_no,INTERMEDIARY_NAME,PROTOCOL_NO,SERVICE_CODE,EMP_NAME,MANAG_CODE,MANAG,TEAM_CODE,TEAM_NAME,TRANS_TYPE@TDH,EMP_NO@TDH";
				$("#agentInfo4Table tr:eq(1) td:eq(0)").attr("colspan",19).siblings().remove();
				var inputObj ="<input style='width:100%' name='commRate_Div' onchange='changecommRate_Div(this)'/>";
				var tableContent = creatTable1(fieldNames,page,checkboxObj,inputObj);
				var tableObj = $("#agentInfo4Table");
				tableObj.find("tbody").remove();
				tableObj.append(tableContent);
				
				var strPage = creatChannelPage4(param.current,6,page.maxPage,"48");
				var pageDIV = $("#agentInfo4Page");
				pageDIV[0].innerHTML="";
				pageDIV.append(strPage);
				
				$("#agentInfo4Table").find("tr").each(function(){
					var id = $(this).children("td:eq(1)").html();
					if(map.containsKey(id)){
						$(this).addClass("table_highlighter");
						$(this).children("td:eq(0)").find("input[name='agentInfo4checkbox']").prop("checked",true);
						$(this).find("input[name='commRate_Div']").val(map.get(id).commRate);
					}
				});
				$('#agentInfo4Div').OpenDiv();
				bindradio();
			}
		});
	}
	
	//校验手续费比例格式
	function changecommRate_Div(obj){
		var reg=/^0(\.\d{0,6})?$/;
	    if(obj.value!=""){
	        if(!reg.test(obj.value)){
	        	$.message("error","手续费比例：只能录入0到1之间的有效数字");
	        	window.setTimeout(function(){ obj.focus(); }, 0);
	        	return false; 
	        }
	    }
	}
	//点击“保存(已选的总对总代理信息)”
	function saveChosenAgentInfo4(){
		var selectedAgentInfo4 = $("input[name='agentInfo4checkbox']:checked");
		if(selectedAgentInfo4.length!=0){
			var flag= false;
			selectedAgentInfo4.each(function(i){
				var obj=$(this).parent().parent().find("input[name='commRate_Div']");
				var commRate= obj.val();
				if(commRate!=""){
					var reg=/^0(\.\d{0,6})?$/;
			        if(!reg.test(commRate)){
			        	$.message("error","手续费比例：只能录入0到1之间的有效数字(最多6位小数)");
			        	flag = true;
			        	window.setTimeout(function(){ obj.focus(); }, 0);
			        	return false; 
			        }
			    }
			});
			if(flag){
				return;
			}
		}
		if(selectedAgentInfo4.length!=0){
			selectedAgentInfo4.each(function(i){
				var obj = new Object();
				obj.id= $(this).parent().parent().children("td:eq(1)").html();
				var columnes=$("#agentInfo4Table").find("th").length;
				obj.branch=$(this).parent().parent().children("td:eq(7)").html();
				obj.commRate= $(this).parent().parent().find("input[name='commRate_Div']").val();
				map.put(obj.id,obj);
			});
		}
		var plan_code = $("#plan_code").val();
		for(i in map.keys()){
			var key = map.keys()[i];
	       if(key==undefined){
	    	   map.remove(key)
	       }
	    }
		if(map.isEmpty()){
			$.message("error", "请选择销售业务信息");
			return;
		}else{
			agentInfoList = new Array();
			for(i in map.keys()){
				var key = map.keys()[i];
		        agentInfoList.push(map.get(key));
		    }
			agentInfoListStr=JSON.stringify(agentInfoList);
		}
		updateAgentInfoRela({plan_code:plan_code,agentInfoListStr:agentInfoListStr,agent_type:'4'});

	}	
	//更新方案关联的代理信息
	function updateAgentInfoRela(param){
		$.openLoading();
		$.ajax({
			url : "<%=path%>/CreditPlan/updateAgentInfoRela?"+new Date().getTime(),
			type : 'POST',
			async : true,
			data:param,
			dataType:'json',
			success:function(data){
				$.closeLoading();
				if($.validate(data))return;

				var agent_type= $.trim($("#agent_type").val());
				if(agent_type=="4"){
					mapBak.clear();
					for(i in map.keys()){
						var key = map.keys()[i];
				        mapBak.put(key,map.get(key));
				    }
					queryAgentInfoRela4(1);
					$("#agentInfo4Div").CloseDiv();
				}
			}
		});
	}
	//关闭 个人/总对总销售业务信息配置  弹出层
	function closeAgentInfoDiv(obj){
		var selectedAgentInfo = $("input[name^=agentInfo]:checked");
		if(selectedAgentInfo.length!=0){
			selectedAgentInfo.each(function(i){
				$(this).prop("checked",false);
			});
		}
		
		map.clear();
		for(i in mapBak.keys()){
			var key = mapBak.keys()[i];
	        map.put(key,mapBak.get(key));
	    }
		$("#confStatus_4").val("");
		$("#branch").val("");
		$("#branchName").val("");
		$("#"+obj).CloseDiv();	
	}
	function closeDetailDiv() {
		$("#productDetail").CloseDiv();
		
		mainContent = "";
		
		$("#mainContentDiv").html("");
	}
/********************************************************************************/
function changePerson(){
	var flag = $("#is_same_person").val();
	if(flag==1){
		$("#is_same_person_td").removeAttr("style");
		$("#is_same_person_td").attr("style","width:532px;");
		$("#is_bundling_bbr_1").hide();
		$("#is_bundling_bbr_td").hide();
		$("#is_bundling_bbr_table_1").hide();
		$("#is_bundling_bbr_table_2").hide();
	}else{
		$("#is_same_person_td").removeAttr("style");
		$("#is_same_person_td").attr("style","width:40%;");
		$("#is_bundling_bbr_1").show();
		$("#is_bundling_bbr_td").show();
	    $("#is_bundling_bbr").html("<option value='0' selected='selected' >否</option><option value='1'>是</option>"); 
		is_bundling_bbr_1();
	}
}

$(window).resize(function(){
	var a = document.getElementById("inputForm").offsetWidth;
	$("#a4").css("width",a-10+"px");
});

$(document).ready(function (){
	var a = document.getElementById("inputForm").offsetWidth;
	$("#a4").css("width",a-10+"px");
	<c:choose>
		<c:when test="${not empty plan_code || not empty oldplan_code}">
		</c:when>
		<c:otherwise>
			changePerson();
		</c:otherwise>
	</c:choose>
	var href = window.location.href.split(":")[1];
	$("#href").val(href);
	farmflag(1);
	underWritingRuleChange();
});
/* 是否固化 */
function is_bundling_bbr_1(){
	var flag = $("#is_bundling_bbr").val();
	if(flag == 1){
		var type=$("input[name='custType']:checked").val();
		if(type == 1){
			$("#is_bundling_bbr_table_1").show();
			$("#is_bundling_bbr_table_2").hide();
		}else{
			$("#is_bundling_bbr_table_2").show();
			$("#is_bundling_bbr_table_1").hide();
		}
	}else{
		$("#is_bundling_bbr_table_1").hide();
		$("#is_bundling_bbr_table_2").hide();
	}
}

function changeType(type){
	var flag = $("#is_bundling_bbr").val();
	if(type == 1){
		$("input[type=radio][name=custType][value=1]").attr("checked",true)
		$("input[type=radio][name=custType][value=2]").attr("checked",false)
	}else{
		$("input[type=radio][name=custType][value=2]").attr("checked",true)
		$("input[type=radio][name=custType][value=1]").attr("checked",false)
	}
	if(flag ==1){
		if(type == 1){
			$("#is_bundling_bbr_table_1").show();
			$("#is_bundling_bbr_table_2").hide();
		}else{
			$("#is_bundling_bbr_table_2").show();
			$("#is_bundling_bbr_table_1").hide();
		}
	}
}

function queryCustByIdentufyNo(){
	var identifyNo = $("#identifyNo").val();
	if(identifyNo == ""){
		return false;
	}
	var href = $("#href").val();
	$.ajax({
		url : "<%=path%>/CreditPlan/queryCust",
		type : 'POST',
		async : false,
		data:{identifyNo:identifyNo,custType:"1",href:href},
		dataType:'json',
		success:function(data){
			$("#customerCode_1").html(data.customerCode);
			$("#customerName_1").html(data.customerName);
			$("#sex_1").html(data.sex);
			$("#telephone_1").html(data.telephone);
			$("#nation_1").html(data.nation);
			$("#pesidence_1").html(data.pesidence);
		}
	});
}

/* 业务标志 */
function farmflag(id){
	 if(id == 1){
		setSelectChecked("businessClass","55");
		$(".syxsn").show();
		$(".zcxsn").hide();
		$(".zcl").hide();
		$(".csl").hide();
	}else if(id == 2){
		setSelectChecked("businessClass","54");
		$(".syxsn").hide();
		$(".zcxsn").show();
		$(".zcl").hide();
		$(".csl").hide();
	}else if(id == 3){
		setSelectChecked("businessClass","31");
		$(".syxsn").hide();
		$(".zcxsn").hide();
		$(".zcl").show();
		$(".csl").hide();
	}else if(id == 4){
		setSelectChecked("businessClass","410");
		$(".syxsn").hide();
		$(".zcxsn").hide();
		$(".zcl").hide();
		$(".csl").show();
	} 
} 

/** 
 * 设置select选中 
 * @param selectId select的id值 
 * @param checkValue 选中option的值 
*/  
function setSelectChecked(selectId, checkValue){
    var select = document.getElementById(selectId);
    for(var i=0; i<select.options.length; i++){  
        if(select.options[i].value == checkValue){
            select.options[i].selected = true;  
            break;  
        }  
    }  
}; 


/* 业务来源 */
 function isAgent(){
	 var options=$("#new_bsns_type option:selected").text();
	 if(options.match("代理")){
		 $("#agent").show();
	 }else{
		 $("#agent").hide();
	 }
}


 	/**代理类型改变**/
	function changeAgent(){
		var agent_type=$('#agent_type').val();
		if($('#isThirdPlan').val()!='1'&&agent_type=='6'){
			$('#agent_type').val('1');
			if($("#partner_code").val()==""){
				$.message('error',"请先选中合作伙伴");
			}else{
				$.message('error',"此合作伙伴不支持接口传入方案");
			}
			changeAgent();
			return;
		}
		var dptCode=$("#dept_code").val()
		isDisable("emp_no", false);
		isDisable("emp_name", false);
		isDisable("team_code", false);
		isDisable("team_name", false);
		isDisable("interMediary_code", false);
		isDisable("agreement_code", false)
		$('input[onclick="openDeptDiv()"]').attr("disabled",false)
		isDisable("service_code", false)
		isDisable("", false)
		isDisable("commRate", false);
		isDisable("markpre_rate", false);
		isDisable("busper_rate", false);
		$('#cRate').html('手续费比例：');
		$('#mRate').html('市场维护费比例：');
		$('#bRate').html('业务绩效比例：');
		isDisable("searchDeptBtn", false);
		$("tr[id^=agentType1]").css('display','none');
		$("tr[id^=agentType4]").css('display','none');
		$('#sale1').hide();
		$('#sale2').hide();
		//1、合作伙伴代理3、个人代理4、总对总代理7.激活卡代理
		if('1'==agent_type){
			$("#quDaomessage").show();
			$("#_div").css('display','');
			$("#_div_cue").css('display','');
			$("#_title").css('display','');
			$("tr[id^=quDao0]").css('display','');
			$("tr[id^=agentType1]").css('display','');
			$("#commRateSpan").empty();
		 	$("#deptCode101").empty();
			$("#deptCode102").empty();
			$("#deptCode101").append("出单机构：");
			$("#deptCode102").append("<input id='dept_code' readonly='readonly' style='background-color: #ccc;' class='input_text' value='"+dptCode+"'><span class='red'>*</span>&nbsp;&nbsp;<input type='button'  class='input_button_2' value='请选择' onClick='openDeptDiv()' />");
		}else if('4'==agent_type){
			$("#quDaomessage").hide();
			$("#_div").css('display','none');
			$("#_div_cue").css('display','none');
			$("#_title").css('display','none');
			$("tr[id^=quDao0]").css('display','none');
			$("tr[id^=agentType4]").css('display','');
			$("#deptCode101").empty();
			$("#deptCode102").empty();
			$("#deptCode102").append("<input type='hidden' id='dept_code' />");
		}else{
			$("#_div").css('display','none');
			$("#_div_cue").css('display','none');
			$("#_title").css('display','none');
			$("tr[id^=quDao0]").css('display','none');
			$("tr[id^=agentType1]").css('display','');
			$("tr[id^=agentType4]").css('display','none');
			$("#commRateSpan").empty();
			$("#deptCode101").empty();
			$("#deptCode102").empty();
			$("#deptCode101").append("出单机构：");
			$("#deptCode102").append("<input id='dept_code' readonly='readonly' style='background-color: #ccc;' class='input_text'><span class='red'>*</span>&nbsp;&nbsp;<input type='button'  class='input_button_2' value='请选择' onClick='openDeptDiv()' />");
		}
		if('6'==agent_type){
			isDisable("", false);
		}else{
			isDisable("", true);
		}
	} 
 	/* 信息重置 */
	function restartMessage(){
		$("#identifyNo").val('');
		$("#licenseCode_qy").val('');
		$("#customerName_qy").val('');
		$("#instituteCode_qy").val('');
		
		$("#customerCode_1").html('&nbsp;');
		$("#customerName_1").html('&nbsp;');
		$("#sex_1").html('&nbsp;');
		$("#telephone_1").html('&nbsp;');
		$("#nation_1").html('&nbsp;');
		$("#pesidence_1").html('&nbsp;');
		
		$("#customerCode_2").html('&nbsp;');
		$("#customerName_2").html('&nbsp;');
		$("#instituteCode_2").html('&nbsp;');
		$("#licenseCode_2").html('&nbsp;');
		$("#mailingAddress_2").html('&nbsp;');
	}
 	/* 核保规则 */
 	function underWritingRuleChange(){
 		var type = $('input[name="underWritingRule"]:checked').val();
 		if(type == 0){
 			$("input[type=radio][name=review_the_rules][value='0']").attr("checked",true);
 			$("input[type=radio][name=review_the_rules][value='1']").attr("disabled","disabled");
 		}else{
 			$("input[type=radio][name=review_the_rules][value='1']").removeAttr("disabled","disabled");
 		}
 	}
 	
 	/* 企业客户查询 */
 	function queryCust(){
 		var licenseCode = $("#licenseCode_qy").val();
 		var customerName = $("#customerName_qy").val();
 		var instituteCode = $("#instituteCode_qy").val();
 		var href = $("#href").val();
 		var flag = 0;
 		if(licenseCode.length >0){
 			flag += 1;
 		}
 		if(customerName.length >0){
 			flag += 1;
 		}
 		if(instituteCode.length >0){
 			flag += 1;
 		}
 		if(flag == 0){
 			return false;
 		}
 		$.ajax({
 			url : "<%=path%>/CreditPlan/queryCust",
 			type : 'POST',
 			async : false,
 			data:{licenseCode:licenseCode,customerName:customerName,instituteCode:instituteCode,custType:"2",href:href},
 			dataType:'json',
 			success:function(data){
 				$("#customerCode_2").html(data.customerCode);
 				$("#customerName_2").html(data.customerName);
 				$("#instituteCode_2").html(data.instituteCode);
 				$("#licenseCode_2").html(data.licenseCode);
 				$("#mailingAddress_2").html(data.mailingAddress);
 			}
 		});
 	}
/********************************************************************************/
</script>
<body>
	<div class="current">
		<table class="current_table_1">
	    	<tbody>
				<tr class="f2">
					<td><img src="./images/current_1.jpg"></td>
					<td class="current_table_1_td"><img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
						<span style="color: #136bab;">信保产品管理 <span style="padding: 0 5px; font-weight: bold; line-height: 28px;">&gt;</span>方案配置
							<span style="padding: 0 5px; font-weight: bold; line-height: 28px;">&gt;</span>
							<c:if test="${not empty plan_code }">投保方案编辑&nbsp;
								<span style="padding: 0 5px; color: #FF0000; "font-weight:bold; line-height:28px;">（方案编辑后需重新审核）</span>
							</c:if> 
							<c:if test="${empty plan_code }">
								投保方案新增
							</c:if>
						</span>
					</td>
					<td>
						<img src="./images/current_3.jpg">
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<input type="hidden" id="href" value=""/>
	<c:choose>
		<c:when test="${not empty plan_code}">
			<input type="hidden" value="${plan_code }" id="hideplan_code">
		</c:when>
		<c:when test="${not empty oldplan_code}">
			<input type="hidden" value="${oldplan_code }" id="hideplan_code">
		</c:when>
	</c:choose>
	<form id="inputForm">
		<table class="table_c">
			<tbody>
				<tr>
					<td colspan="4"
						style="font-size: 12px; font-weight: bold; text-align: left; color: #3876bf; line-height: 17px; background-image: url(images/centent_1.jpg)">
						<c:if test="${not empty plan_code}">投保方案编辑</c:if> 
						<c:if test="${empty plan_code}">投保方案新增</c:if>
					</td>
				</tr>
			</tbody>
		</table>
		<h3>&nbsp;基本信息</h3>
		<table class="table_c">
			<tbody>
				<tr>
					<th width="10%">方案代码：</th>
					<td width="40%"><input name="plan_code" id="plan_code"
						readonly="readonly" style="background-color: #ccc;"
						class="input_text"><span class="red">*</span>&nbsp;<span
						style="${ptnEnv}">上线方案专用：<input type="checkbox"
							id='isProprod' />&nbsp;<img src="/manager/images/caldef.jpg"
							title="此选项可保证测试环境与生产环境方案号一致及防止方案号冲突。仅供后续会升级正式环境的方案使用，不上线的方案不允许勾选！"></span></td>
					<th width="10%">方案名称：</th>
					<td width="40%"><input name="plan_name" id="plan_name"
						class="input_text"><span class="red">*</span></td>
				</tr>
				<tr>
					<th>产品代码：</th>
					<td><input name="prod_code" id="prod_code" readonly="readonly"
						style="background-color: #ccc;" class="input_text"><span
						class="red">*</span>&nbsp; <c:if test="${empty plan_code}">
							<input type="button" class="input_button_2" id="searchProdBtn"
								value="请选择" onClick="openCreditProdDiv(1,this)" />
						</c:if> <c:if test="${not empty plan_code}">
							<input type="button" disabled="disabled" id="searchProdBtn"
								value="请选择" onClick="openCreditProdDiv(1,this)" />
						</c:if> <input type="hidden" id="prodSaleCode" />
					<!-- 选择产品时赋值，该值是为了向销管获取代理信息时传参 --></td>
					<th>产品名称：</th>
					<td><input name="prod_name" id="prod_name" readonly="readonly"
						style="background-color: #ccc;" class="input_text"><span
						class="red">*</span>&nbsp;</td>
				</tr>
				<tr>
					<th>合作伙伴代码：</th>
					<td><input name="partner_code" id="partner_code"
						readonly="readonly" style="background-color: #ccc;"
						class="input_text"><span class="red">*</span>&nbsp; <c:if
							test="${empty plan_code}">
							<input type="button" class="input_button_2"
								id="searchChannelInfoBtn" value="请选择"
								onClick="openChannelInfoDiv()" />
						</c:if> <c:if test="${not empty plan_code}">
							<input type="button" disabled="disabled"
								id="searchChannelInfoBtn" value="请选择"
								onClick="openChannelInfoDiv()" />
						</c:if></td>
					<th>方案状态：</th>
					<td><select id="status" class="select_1 valid"
						style="visibility: visible;" onchange="changeState()"><option value="0">无效</option>
							<option value="1">有效</option></select><span class="red">*</span>&nbsp;</td>
				</tr>
				<tr>
					<th>方案销售类型：</th>
					<td><select id="agent_type" name="agentTypeSel"
						onchange="changeAgent()" class="select_1 valid"
						style="visibility: visible;">
							<%-- <c:forEach var="agent_type" items="${agentTypes}">
								<option value="${agent_type.code}"
									title="${agent_type.codeName}">${agent_type.codeName}</option>
							</c:forEach> --%>
							<option value="1" title="合作伙伴代理">合作伙伴代理</option>
							<option value="4" title="总对总">总对总</option>
					</select><span class="red">*</span>&nbsp;</td>
					<th>是否见费：</th>
					<td>
						<div style="float: left; width: 90%;">
							<select id="is_see_money" class="select_1 valid"
								 style="visibility: visible ;">
								<option value="1">否</option>
								<option value="0">是</option>
							</select><span class="red">*</span>
						</div>
					</td>
				</tr>
				<tr>
					<th>核保规则：</th>
					<td><input type="radio" name="underWritingRule"
						checked="checked" value="0" onchange="underWritingRuleChange()" /><span style="margin-left:3px;">自动核保</span>
						<input type="radio" name="underWritingRule"
						onchange="underWritingRuleChange()" value="1" style="margin-left:9px;"/><span style="margin-left:3px;">在信保系统核保</span><span
						class="red">*</span></td>
					<th><span class="red">审核规则：</span></th>
					<td>
						<div style="float: left; width: 90%;">
							<input id="review_the_rules" type="radio" name="review_the_rules" value="0"/><span style="margin-left:3px;">审核通过</span>
							<input type="radio" name="review_the_rules" value="1" style="margin-left:9px;"/><span style="margin-left:3px;">在信保系统审核</span>
							<span class="red" style="margin-left:-5px;">*</span>&nbsp;
						</div>
					</td>
				</tr>
				<tr>
					<th>保监会分险种：</th>
					<td colspan="4">
						<div style="float: left; width: 50%;">
							<select id="projectType" class="select_1 valid" onchange=""
								style="visibility: visible;">
								<option value="1">个人消费类贷（借）款保证保险</option>
								<option value="2">个人购车贷款保证保险</option>
								<option value="3">个人购房贷款保证保险</option>
								<option value="4">小微企业贷款保证保险</option>
								<option value="5">其他企业贷款保证保险</option>
								<option value="6">其他</option>
								<option value="7">小计</option>
								<option value="8">知识产权类质押保证保险</option>
								<option value="9">小额贷款保证保险</option>
								<option value="10">融资租赁保证保险</option>
							</select><span class="red">*</span>&nbsp;
						</div>
					</td>
				</tr>
			</tbody>
		</table>
		<h3>&nbsp;立项信息</h3>
		<table class="table_c">
			<tbody>
				<tr>
					<th id='' width="10%">立项代码：</th>
					<td width="40%"><input id="setProjectCode" class="input_text"><span
						class="red">*</span></td>
					<th id='' width="10%">立项名称：</th>
					<td width="40%"><input id="setProjectName" class="input_text"><span
						class="red">*</span></td>
				</tr>
			</tbody>
		</table>
		<h3>&nbsp;投/被保人信息</h3>
		<table class="table_c">
			<tbody>
				<tr>
					<th id='is_same_person_1' width="164px;">投/被保人是否为同一人：</th>
					<td id="is_same_person_td" style="width:532px;"><select name="is_same_person" id="is_same_person"
						class="select_1 valid" onchange="changePerson()"
						style="visibility: visible;">
							<option value="1" selected="selected">是</option>
							<option value="0">否</option>
					</select><span class="red">*</span>&nbsp;</td>
					<th id='is_bundling_bbr_1' width="164px;">被保人信息<span
						class="red">是否固化：</span></th>
					<td id="is_bundling_bbr_td"><select
						id="is_bundling_bbr" name="is_bundling_bbr" class="select_1 valid"
						onchange="is_bundling_bbr_1()" style="visibility:visible;width:50px;">
							<option value="0" selected="selected">否</option>
							<option value="1">是</option>
					</select>&emsp;&emsp;&emsp; <input type="radio" name="custType" value="1"
						checked="checked" onchange="changeType(this.value)" />&nbsp;个人客户&emsp;&emsp;
						<input type="radio" name="custType" value="2"
						onchange="changeType(this.value)" />&nbsp;企业客户
					</td>
				</tr>
			</tbody>
		</table>
		<div id="is_bundling_bbr_table_1">
			&emsp;证件号码： <input id="identifyNo" class="input_text" />&emsp; <input
				id="custQuery" class="" type="button" value="客户查询"
				onclick="queryCustByIdentufyNo()" />&emsp; <input
				class="" type="button" value="信息重置" onclick="restartMessage()" />&emsp;
			<table class="table" id=""
				style="border-collapse: collapse; empty-cell: show;">
				<tbody>
					<tr>
					</tr>
					<tr style="background: #DBE7F5;">
						<th width="15%">客户代码</th>
						<th width="10%">客户名称</th>
						<th width="10%">性别</th>
						<th width="20%">手机号码</th>
						<th width="15%">民族</th>
						<th width="30%">户籍所在地</th>
					</tr>
					<tr>
						<td id='customerCode_1'>&nbsp;</td>
						<td id='customerName_1'>&nbsp;</td>
						<td id='sex_1'>&nbsp;</td>
						<td id='telephone_1'>&nbsp;</td>
						<td id='nation_1'>&nbsp;</td>
						<td id='pesidence_1'>&nbsp;</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div id="is_bundling_bbr_table_2">
			&emsp;营业执照号码： <input id="licenseCode_qy" class="input_text" />&emsp;
			&emsp; 企业名称： <input id="customerName_qy" class="input_text" />&emsp;
			&emsp; 组织机构代码： <input id="instituteCode_qy" class="input_text" />&emsp;&emsp;
			<input id="" class="" type="button" value="客户查询" onclick="queryCust()" />&emsp;
			<input id="" class="" type="button" value="信息重置"
				onclick="restartMessage()" />&emsp;
			<table class="table" id="">
				<tbody>
					<tr>
					</tr>
					<tr style="background: #DBE7F5;">
						<th width="20%">客户代码</th>
						<th width="20%">企业名称</th>
						<th width="20%">组织机构代码</th>
						<th width="20%">营业执照号码</th>
						<th width="20%">通讯地址</th>
					</tr>
					<tr>
						<td id='customerCode_2'>&nbsp;</td>
						<td id='customerName_2'>&nbsp;</td>
						<td id='instituteCode_2'>&nbsp;</td>
						<td id='licenseCode_2'>&nbsp;</td>
						<td id='mailingAddress_2'>&nbsp;</td>
					</tr>
				</tbody>
			</table>
		</div>
		<h3>&nbsp;保单信息</h3>
		<table class="table_c">
			<tbody>
				<tr>
					<th id='' width="10%">免赔率(%)：</th>
					<td width="40%"><input name="" id="franchiserate"
						class="input_text" onKeyUp="" onBlur="checkNum(this)"></td>
					<th id='' width="10%">赔偿比例(%)：</th>
					<td><input name="" id="compenSationRatio" class="input_text"
						value="" onKeyUp="clearNoNum(event,this)" onBlur="checkNum(this)">
					</td>
				</tr>
				<tr>
					<th id='' width="10%">赔偿等待期（天）：</th>
					<td width="40%"><input name="" id="waitingPeriod"
						class="input_text" onKeyUp="clearNoNum(event,this)"
						onBlur="checkNum(this)"></td>
					<th width="10%">保费（元）：</th>
					<td width="40%"><input id="premium" class="input_text" />
				</tr>
				<tr>
					<th width="10%">是否共保：</th>
					<td width="40%"><select id="is_pool" class="select_1 valid"
						onchange="" style="visibility: visible;">
							<option value="0">否</option>
							<!--   <option value="1" >是</option> -->
					</select><span class="red">*</span></td>
					<th width="10%">是否为互联网平台业务：</th>
					<td><select id="isInternetps" class="select_1 valid"
						onchange="" style="visibility: visible;">
							<option value="1">是</option>
							<option value="0">否</option>
					</select><span class="red">*</span></td>
				</tr>
				<tr>
					<th width="10%">业务种类：</th>
					<td width="40%"><select id="businessTypes"
						class="select_1 valid" onchange="" style="visibility: visible;">
							<option value="0" selected="selected">协同业务</option>
							<option value="1">市场业务</option>
					</select><span class="red">*</span></td>
					<th width="10%">业务标志：</th>
					<td><select id="farmFlag" class="select_1 valid"
						onchange="farmflag(this.options[this.options.selectedIndex].value)"
						style="visibility: visible;">
							<option value="1" selected="selected">商业性涉农</option>
							<option value="2">政策性涉农</option>
							<option value="3">资产类</option>
							<option value="4">城市类</option>
					</select><span class="red">*</span></td>
				</tr>
				<tr>
					<th width="10%">业务分类：</th>
					<td width="40%"><select id="businessClass"
						class="select_1 valid" onchange="" style="visibility: visible;">
							<option class="syxsn" value="55">市场化农贷保</option>
							<option class="syxsn" value="56">短期借款人还贷保证险</option>
							<option class="zcxsn" value="54">农联推荐类农贷保</option>
							<option class="zcxsn" value="57">农险推荐类农贷保</option>
							<option class="zcl" value="31">协同化</option>
							<option class="zcl" value="32">市场化</option>
							<option class="zcl" value="33">蚂蚁合作类</option>
							<option class="csl" value="410">融资租聘</option>
							<option class="csl" value="411">供应链金融</option>
							<option class="csl" value="412">政银保</option>
							<option class="csl" value="413">工程保函及诉讼保全</option>
							<option class="csl" value="414">贸易信用险</option>
							<option class="csl" value="48">抵质押类</option>
							<option class="csl" value="49">消费贷</option>
					</select><span class="red">*</span></td>
					<th width="10%">是否电子保单：</th>
					<td><select id="is_epolicy" class="select_1 valid" 
						style="visibility: visible;">
							<option value="N">否</option>
							<option value="Y">是</option>
					</select><span class="red">*</span></td>
				</tr>
			</tbody>
		</table>
		<table class="table_c">
			<tbody>
				<tr>
					<th width="10%">特别约定：</th>
					<td width="90%" colspan="4"><textarea name="special_arran" id="special_arran" rows="5"
							class="textarea_1" style="resize:none;"></textarea></td>
				</tr>
			</tbody>
		</table>
		<table class="table_c">
			<tbody>
				<tr>
					<th>司法管辖权：<span class="red">*</span></th>
					<td colspan="4"><textarea id="jurisdictionRight" class="textarea_1" style="resize:none;"></textarea></td>
				</tr>
			</tbody>
		</table>
		<table class="table_c">
			<tbody>
				<tr>
					<th>合同争议处理方式：</th>
					<td><select name="contractSolution"
						onchange="contractSolution1()" id="contractSolution"
						class="select_1 valid" style="visibility: visible;">
							<option value="1">仲裁 </option>
							<option value="0">诉讼 </option>
					</select></td>
					<th width="10%">仲裁委员会名称：</th>
					<td width="40%">
						<input name="committee" class="input_text" id="committee" value=""/><span id="committee_span" class="red">*</span><span>&nbsp;</span></td>
				</tr>
				<tr>
					<th id='' width="10%">操作人：</th>
					<td width="40%"><input name="chargerCode" id="chargerCode"
						class="input_text"><span class="red">*</span></td>
					<th id='' width="10%">操作人归属机构：</th>
					<td width="40%"><input name="comCode" id="comCode"
						class="input_text"><span class="red">*</span></td>
				</tr>
			</tbody>
		</table>
		<table class="table_c">
			<tbody>
				<!--agentType4   总对总代理   -->
				<tr id="agentType401" style="display: none;">
					<!-- style="display:none" -->
					<c:if test="${not empty plan_code }">
						<th width="10%">总对总销售业务信息：</th>
						<td colspan="3" width="90%"><input type="button"
							onclick="openAgentInfo4Div()" value="配置总对总销售渠道信息" />&emsp;&emsp;&emsp;
						</td>
					</c:if>
					<c:if test="${empty plan_code }">
						<th width="10%">总对总销售业务信息：</th>
						<td colspan="3" width="90%"><input type="button"
							disabled="disabled" onclick="openAgentInfo4Div()"
							value="配置总对总销售渠道信息" />&emsp;&emsp;&emsp;</td>
					</c:if>
				</tr>
				<c:if test="${not empty plan_code || not empty oldplan_code }">
					<tr id="agentType402">
						<td colspan="4">
							<div id="a4" style="width: 1345px; height: auto; overflow: scroll;">
								<table id="agentInfoRela4Table"
									style="width: 1950px; text-align: center;">
									<thead>
										<tr style="background-color: C0C0C0;">
											<th style="width: 80px;">销售类型</th>
											<th style="width: 100px;">合作伙伴</th>
											<th style="width: 100px;">网点名称</th>
											<th style="width: 80px;">网点代码</th>
											<th style="width: 80px;">出单机构</th>
											<th style="width: 90px;">归属渠道</th>
											<th style="width: 120px;">渠道类型</th>
											<th style="width: 100px;">业务来源</th>
											<th style="width: 80px;">代理人编码</th>
											<th style="width: 80px;">代理人名称</th>
											<th style="width: 80px;">代理协议号</th>
											<th style="width: 80px;">服务代码</th>
											<th style="width: 80px;">业务员名称</th>
											<th style="width: 120px;">经办人归属机构代码</th>
											<th style="width: 80px;">经办人代码</th>
											<th style="width: 120px;">经办人所属团队代码</th>
											<th style="width: 120px;">经办人所属团队名称</th>
											<th style="width: 80px">手续费比例</th>
										</tr>
									</thead>
									<tfoot>
										<tr>
											<td colspan="21">
												<div id="agentInfoRela4PageDIV" class="page"></div>
											</td>
										</tr>
									</tfoot>
									<tbody>
									</tbody>
								</table>
							</div>
						</td>
					</tr>
				</c:if>
			</tbody>
		</table>
		<div id="quDaomessage">
			<h3>&nbsp;渠道信息</h3>
			<table class="table_c">
				<tbody>
					<tr id="quDao01">
						<th>渠道名称：</th>
						<td width="40%"><select id="channleCode_QD"
							name="channleCode_QD" onchange="changeChannleCode_QD()"
							class="select_1 valid" style="visibility: visible;">
								<option value="">-----请选择渠道名称-----</option>
								<c:forEach var="belongToChannel" items="${belongToChannelList}">
									<option value="${belongToChannel.code}"
										title="${belongToChannel.codeName}">${belongToChannel.codeName}</option>
								</c:forEach>
						</select><span class="red">*</span></td>
						<th>渠道类型：</th>
						<td width="40%"><select id="channel_type"
							class="select_1 valid" onchange="changeChannleType()"
							style="visibility: visible;">
								<option value="">-----请选择渠道类型-----</option>
								<c:forEach var="channelType" items="${channelTypeList}">
									<option value="${channelType.code}"
										title="${channelType.codeName}">${channelType.codeName}</option>
								</c:forEach>
						</select><span class="red">*</span></td>
					</tr>
					<tr id="">
						<th>业务来源：</th>
						<td width="40%"><select id="new_bsns_type"
							onchange="changenew_bsns_type()" class="select_1 valid"
							style="visibility: visible;" name="Ssss">
								<option value="">-----请选择业务来源-----</option>
								<c:forEach var="newBSList" items="${newBSList}">
									<option value="${newBSList.code}">${newBSList.codeName}</option>
								</c:forEach>
						</select><span class="red">*</span></td>
						<th>经办人归属机构代码：</th>
						<td width="40%"><input name="" id="companyCode"
							class="input_text" value=""><span class="red">*</span></td>
					</tr>
					<tr>
						<th id="deptCode101">出单机构代码：</th>
						<td id="deptCode102"><input id="dept_code"
							readonly="readonly" style="background-color: #ccc;"
							class="input_text"><span class="red">*</span>&nbsp; <input
							type="button" class="input_button_2" id="searchDeptBtn"
							value="请选择" onClick="openDeptDiv()" /></td>
						<th>经办人所属团队名称：</th>
						<td><input name="team_name" id="team_name" class="input_text"
							value=""><span class="red">*</span></td>
					</tr>
					<tr>
						<th>经办人所属团队代码：</th>
						<td><input name="team_code" id="team_code" class="input_text"
							value=""><span class="red">*</span></td>
						<th>经办人代码：</th>
						<td><input name="emp_no" id="emp_no" class="input_text"
							value=""><span class="red">*</span></td>
					</tr>
					<tr>
						<th>业务员名称：</th>
						<td><input id="emp_name" class="input_text"><span
							class="red">*</span></td>
						<th>服务代码：</th>
						<td>
							<div id="service_code_select_div" style="display: none">
								<select id="service_code_select" onchange="changeservice_code()"
									class="select_1"></select>
							</div> <input id="service_code" class="input_text" /> <span class="red"
							style="margin-left: -5px">*</span>&nbsp;
						</td>
					</tr>
				</tbody>
			</table>
			<div id="agent" style="display: none;">
				<h3>&nbsp;代理信息</h3>
				<table class="table_c">
					<tbody>
						<tr>
							<th>代理人编码：</th>
							<!-- interMediary_code  -->
							<td><input id="interMediary_code" class="input_text" /><span
								class="red">*</span></td>
							<th>代理人名称：</th>
							<td><input id="interMediary_name" class="input_text" /><span
								class="red">*</span></td>
						</tr>
						<tr>
							<th id='' width="10%">手续费比例（%）：</th>
							<td width="40%"><input name="" id="commRate"
								class="input_text" onKeyUp="clearNoNum(event,this)"
								onBlur="checkNum(this)"><span class="red">*</span> <!-- 手续费比例上下限，验证使用 -->
								<input id="feeMaxRate" type="hidden" value="1" /> <input
								id="feeMinRate" type="hidden" value="0" /></td>
							<th width="10%">手续费（元）：</th>
							<td width="40%"><input id="commission_charge" class="input_text"></td>
						</tr>
						<tr>
							<th>代理协议号：</th>
							<!-- agreement_code -->
							<td><input id="agreement_code" class="input_text" /><span
								class="red">*</span></td>
							<th></th>
							<td></td>
						</tr>
					</tbody>
				</table>
			</div>
		</div>
		<div align="center">
			<input class="input_button_3" id="saveCreditPlanBtn" type="button"
				value="保存">&nbsp;&nbsp; <input class="input_button_3"
				id="GoBackCreditPlanBtn" type="button" value="返回"
				onclick="goBackToList()">
		</div>
	</form>
	<!-- begin -------------------------产品 DIV 默认隐藏--------------------------->
	<div id="creditProdDiv" style="display: none; width: 80%;">
		<div class="table_title_div">
			<table class="table_title" style='width: 100%; height: 20px;'>
				<tr>
					<td width="10%"></td>
					<td width="80%" id="interfaceName"></td>
					<td width="10%" align="right"><img
						src="./images/closedown.gif" alt="关闭"
						onclick="closeCreditProdDiv()" /></td>
				</tr>
			</table>
		</div>

		<table class="table_02" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td style="border: 0px; text-align: right;">交易系统产品代码：</td>
							<td style="border: 0px; text-align: left;"><input
								name="txt3" id="prod_code_choose" class="input_text"
								style="width: 120px;"></td>
							<td style="border: 0px; text-align: right;">交易系统产品名称：</td>
							<td style="border: 0px; text-align: left;"><input
								name="txt3" id="prod_name_choose" class="input_text"
								style="width: 120px;"></td>
						</tr>
						<tr height="30px">
							<td style="border: 0px; text-align: right;">定义起期：</td>
							<td style="border: 0px; text-align: left;"><input
								id="startDateBegin" onkeydown="false"
								onclick="showCalendar('startDateBegin','y-mm-dd');$('.calendars').css('z-index',20000);"
								class="input_time" type="text" style="width: 120px;" /></td>
							<td style="border: 0px; text-align: right;">定义止期：</td>
							<td style="border: 0px; text-align: left;"><input
								id="startDateEnd" onkeydown="false"
								onclick="showCalendar('startDateEnd','y-mm-dd');$('.calendars').css('z-index',20000);"
								class="input_time" type="text" style="width: 120px;" />
								&nbsp;&nbsp;&nbsp;&nbsp; <input type="button"
								class="input_button_1" id="searchBtn" value="查询"
								onClick="queryCreditProd(1)" /></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="creditProdTable" class="content_table_1">
						<thead>
							<tr class="f1">
								<th style="width: 5%">选择</th>
								<th style="width: 45%">交易系统产品代码</th>
								<th style="width: 50%">交易系统产品名称</th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="creditProdPageDIV" class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center">
			<input class="input_button_3" type="button"
				onclick="chooseCreditProd()" value="确定">&nbsp;&nbsp; <input
				class="input_button_3" type="button" onclick="closeCreditProdDiv()"
				value="取消">
		</div>
	</div>
	<!-- end -------------------------产品 DIV 默认隐藏--------------------------->

	<!-- begin --------------------------- 合作伙伴 DIV--------------------------->
	<div id="channelInfoDiv" style="display: none; width: 80%;">
		<div class="table_title_div">
			<table class="table_title" style='width: 100%; height: 20px;'>
				<tr>
					<td width="10%"></td>
					<td width="80%" id="interfaceName"></td>
					<td width="10%" align="right"><img
						src="./images/closedown.gif" alt="关闭"
						onclick="closeChannelInfoDiv()" /></td>
				</tr>
			</table>
		</div>
		<table class="table_02" style="width: 98%">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align: center">合作伙伴代码：<input
								name="txt3" id="channelCode_choose" class="input_text" />&nbsp;&nbsp;
								合作伙伴名称：<input name="txt3" id="channelName_choose"
								class="input_text" />&nbsp;&nbsp; <input type="button"
								class="input_button_1" value="查询" onClick="queryChannelInfo(1)" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="channelInfoTable" class="content_table_1">
						<thead>
							<tr class="f1">
								<th style="width: 5%">选择</th>
								<th style="width: 10%">合作伙伴代码</th>
								<th style="width: 20%">合作伙伴名称</th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="channelInfoPageDIV" class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center">
			<input type="button" value="确定" onclick="chooseChannelInfo()"
				class="input_button_3" />&nbsp;&nbsp;&nbsp; <input type="button"
				value="取消" onclick="closeChannelInfoDiv()" class="input_button_3" />
		</div>
	</div>
	<!-- end --------------------------- 合作伙伴 DIV--------------------------->

	<!-- begin ------------------------出单机构 DIV 默认隐藏--------------------------->
	<div id="deptDiv" style="display: none; width: 80%;">
		<div class="table_title_div">
			<table class="table_title" style='width: 100%; height: 20px;'>
				<tr>
					<td width="10%"></td>
					<td width="80%" id="interfaceName"></td>
					<td width="10%" align="right"><img
						src="./images/closedown.gif" alt="关闭" onclick="closeDeptDiv()" /></td>
				</tr>
			</table>
		</div>
		<table class="table_02" style="height: 180px;" align="center">
			<tr>
				<td>
					<table class="search_table">
						<tr height="30px">
							<td colspan="3" style="text-align: center">出单机构代码：<input
								name="txt3" id="deptCode_choose" class="input_text" />&nbsp;&nbsp;
								出单机构名称：<input name="txt3" id="deptCname_choose"
								class="input_text" /> <input type="button"
								class="input_button_1" value="查询" onClick="queryDept(1)" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td>
					<table id="deptTable" class="content_table_1">
						<thead>
							<tr class="f1">
								<th style="width: 5%">选择</th>
								<th style="width: 45%">出单机构代码</th>
								<th style="width: 50%">出单机构名称</th>
							</tr>
						</thead>
						<tbody>
						</tbody>
					</table>
					<div id="deptPageDIV" class="page"></div>
				</td>
			</tr>
		</table>
		<div align="center">
			<input type="button" value="确定" onclick="chooseDept()"
				class="input_button_3" />&nbsp;&nbsp;&nbsp; <input type="button"
				value="取消" onclick="closeDeptDiv()" class="input_button_3" />
		</div>
	</div>
	<!-- end ------------------------出单机构 DIV 默认隐藏--------------------------->
	<!-- begin ----------------------配置总对总销售业务信息 Div------------------------>
	<div id="agentInfo4Div"
		style="display: none; width: 1000px; height: 450px;">
		<div class="table_title_div" style="width: 1000px">
			<table class="table_title" style='width: 1000px; height: 20px;'>
				<tr>
					<td width="120px"></td>
					<td width="1260px" id="interfaceName"></td>
					<td width="60px" align="right"><img
						src="./images/closedown.gif" alt="关闭"
						onclick="closeAgentInfoDiv('agentInfo4Div')" /></td>
				</tr>
			</table>
		</div>
		<div class="table_title_div"
			style="width: 1000px; height: 400px; overflow: scroll;">
			<table class="table_02" style="width: 1750px;" align="center">
				<tr>
					<td>
						<table class="search_table">
							<tr height="30px">
								<td colspan="10" style="text-align: center">配置状态：<select
									id="confStatus_4"><option value="">全部</option>
										<option value="Y">已配置</option>
										<option value="N">未配置</option></select>&nbsp;&nbsp; 网点代码：<input
									id="branch" class="input_text" />&nbsp;&nbsp; 网点名称：<input
									id="branchName" class="input_text" />&nbsp;&nbsp; <input
									type="button" class="input_button_1" value="查询"
									onClick="queryAgentInfo4(1)" />
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table id="agentInfo4Table" class="content_table_1"
							style='overflow: scroll;'>
							<thead>
								<tr class="f1">
									<th style="width: 40px"><input id="agentInfo4CheckAll"
										type="checkbox"></th>
									<th style="width: 80px;">销售类型</th>
									<th style="width: 100px;">合作伙伴</th>
									<th style="width: 100px;">网点名称</th>
									<th style="width: 80px;">网点代码</th>
									<th style="width: 80px;">出单机构</th>
									<th style="width: 90px;">归属渠道</th>
									<th style="width: 110px;">渠道类型</th>
									<th style="width: 110px;">业务来源</th>
									<th style="width: 80px;">代理人编码</th>
									<th style="width: 80px;">代理人名称</th>
									<th style="width: 80px;">代理协议号</th>
									<th style="width: 80px;">服务代码</th>
									<th style="width: 80px;">业务员名称</th>
									<th style="width: 120px;">经办归属机构代码</th>
									<th style="width: 80px;">经办人代码</th>
									<th style="width: 120px;">经办归所属团队代码</th>
									<th style="width: 120px;">经办归所属团队名称</th>
									<th style="width: 50px">手续费比例</th>
								</tr>
							</thead>
							<tbody>
							</tbody>
						</table>
						<div id="agentInfo4Page" class="page"></div>
					</td>
				</tr>
			</table>
		</div>
		<div align="center">
			<input type="button" value="保存" onclick="saveChosenAgentInfo4()"
				class="input_button_3" />&nbsp;&nbsp;&nbsp; <input type="button"
				value="取消" onclick="closeAgentInfoDiv('agentInfo4Div')"
				class="input_button_3" />
		</div>
	</div>
	<!-- 配置总对总区域业务信息 结束-->
	<input type="hidden" id='isThirdPlan'>
</body>
</html>